<?php 
$show_validator = true;
include TMPL_PATH.'public/header.phtml';
?>
<script type="text/javascript" src="/statics/xheditor/xheditor-zh-cn.min.js"></script>
<div class="subnav">
    <div class="content-menu ib-a blue line-x">
        <a href='<?php echo U('attribute/model_list');?>'><em>产品类型管理</em></a><span>|</span>
        <a href='<?php echo U('attribute/attribute_list', 'modelid='.$modelid) ?>'><em><?php echo $model_name;?>-属性列表</em></a><span>|</span>
        <a href='javascript:;' class="on" ><em>添加 <?php echo $model_name;?> 属性</em></a></div>
</div>
<script type="text/javascript"> 
<!--
	$(function(){
		$.formValidator.initConfig({formid:"myform",autotip:true,onerror:function(msg,obj){window.top.art.dialog({content:msg,lock:true,width:'200',height:'50'}, function(){this.close();$(obj).focus();})}});
			$("#attr_name_1").formValidator({onshow:"请输入属性名称",onfocus:"请输入属性名称",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入属性名称"});
			$("#attr_name_6").formValidator({onshow:"请输入属性名称",onfocus:"请输入属性名称",oncorrect:"输入正确"}).inputValidator({min:1,onerror:"请输入属性名称"});
			
	})
//-->
</script>

<form name="myform" id="myform" action="__SELF__" method="post">
<div class="pad-10">
<div class="col-tab">
<ul class="tabBut cu-li">
<?php 
$base_tab = 1;
$langCount = 0;
if(isset($languageList) && $languageList){
		$langCount = count($languageList);
}
$langCount += $base_tab;
?>
<li id="tab_setting_1" class="on" onclick="SwapTab('setting','on','',<?php echo $langCount;?>,1);">基本选项</li>
<?php 
$i = $base_tab+1;
	if(isset($languageList) && $languageList):
		foreach ($languageList as $language_id => $language_name):
	?>
<li id="tab_setting_<?php echo $i;?>" onclick="SwapTab('setting','on','',<?php echo $langCount;?>,<?php echo $i;?>);"><?php echo $language_name;?></li>
<?php
		$i++;
		endforeach;
	endif;
	?>

</ul>
<div id="div_setting_1" class="contentList pad-10">
<table width="100%" class="table_form ">
      <?php if(isset($attr_groups) && $attr_groups):?>
			<tr>
        <th width="150">属性分组：</th>
        <td>
          <select name="attr_group">
          <?php foreach ($attr_groups as $key => $agp):?>
          <option value="<?php echo $key ?>" <?php if(isset($attrInfo['attr_group']) && $attrInfo['attr_group']==$key){echo 'selected';}?>><?php echo $agp;?></option>
          <?php endforeach;?>
          </select>
        </td>
      </tr>
      <?php endif;?>
	<tr>
		<th>是否默认显示：</th>
		<td>
			<input type='radio' name='is_show'
				   value='0' <?php if (isset($attrInfo['is_show']) && $attrInfo['is_show'] == 0) echo 'checked'; ?> >
			否
			<input type='radio' name='is_show'
				   value='1' <?php if (!isset($attrInfo['is_show']) || (isset($attrInfo['is_show']) && $attrInfo['is_show'] == 1)) echo 'checked'; ?>>
			是
			<div class="infoShow">添加产品时属性默认是否显示</div>
		</td>
	</tr>
      <tr>
        <th>是否索引：</th>
        <td>
	  <input type='radio' name='attr_index' value='0' <?php if(!isset($attrInfo['attr_index']) || (isset($attrInfo['attr_index']) && $attrInfo['attr_index']==0))echo 'checked';?> > 否 
	  <input type='radio' name='attr_index' value='1' <?php if(isset($attrInfo['attr_index']) && $attrInfo['attr_index']==1)echo 'checked';?>> 是<div class="infoShow">在产品列表页是否索引属性</div></td>
      </tr>
	   <?php if($is_show_sd): ?>
			<tr>
				<th>是否3D展示：</th>
				<td>
					<input type='radio' name='is_show_sd'
						   value='0' <?php if (!isset($attrInfo['is_show_sd']) || (isset($attrInfo['is_show_sd']) && $attrInfo['is_show_sd'] == 0)) echo 'checked'; ?> >
					否
					<input type='radio' name='is_show_sd'
						   value='1' <?php if (isset($attrInfo['is_show_sd']) && $attrInfo['is_show_sd'] == 1) echo 'checked'; ?>>
					是
					<div class="infoShow">在3D展示页面此属性有3D效果</div>
				</td>
			</tr>
			<tr>
				<th>是否为绣字属性：</th>
				<td>
					<input type='radio' name='is_monogram'
						   value='0' <?php if (!isset($attrInfo['is_monogram']) || (isset($attrInfo['is_monogram']) && $attrInfo['is_monogram'] == 0)) echo 'checked'; ?> >
					否
					<input type='radio' name='is_monogram'
						   value='1' <?php if (isset($attrInfo['is_monogram']) && $attrInfo['is_monogram'] == 1) echo 'checked'; ?>>
					是
				</td>
			</tr>
	<?php endif; ?>
      <tr>
        <th>是否为销售属性：</th>
        <td>
	  <input type='radio' name='attr_sell' value='0' <?php if(!isset($attrInfo['attr_sell']) || (isset($attrInfo['attr_sell']) && $attrInfo['attr_sell']==0))echo 'checked';?> > 否 
	  <input type='radio' name='attr_sell' value='1' <?php if(isset($attrInfo['attr_sell']) && $attrInfo['attr_sell']==1)echo 'checked';?>> 是<div class="infoShow">下单时是否为必须选择的属性(只对成衣有效)</div></td>
      </tr>
      <!--<tr>
        <th>高级定制属性：</th>
        <td>
	  		<input type='radio' name='attr_advanced' value='0' <?php if(!isset($attrInfo['attr_advanced']) || (isset($attrInfo['attr_advanced']) && $attrInfo['attr_advanced']==0))echo 'checked';?> > 否
	  		 <input type='radio' name='attr_advanced' value='1' <?php if(isset($attrInfo['attr_advanced']) && $attrInfo['attr_advanced']==1)echo 'checked';?>> 是
			 <input type='radio' name='attr_advanced' value='2' <?php if(isset($attrInfo['attr_advanced']) && $attrInfo['attr_advanced']==2)echo 'checked';?>> 通用
			 <div class="infoShow">高级定制时出现的属性</div></td>
      </tr>-->
      <tr>
        <th>设计师作品属性：</th>
        <td>
	  		<input type='radio' name='attr_designer' value='0' <?php if(!isset($attrInfo['attr_designer']) || (isset($attrInfo['attr_designer']) && $attrInfo['attr_designer']==0))echo 'checked';?> > 否
	  		 <input type='radio' name='attr_designer' value='1' <?php if(isset($attrInfo['attr_designer']) && $attrInfo['attr_designer']==1)echo 'checked';?>> 是<div class="infoShow">设计师上传作品时出现的属性</div></td>
      </tr>
      <tr>
        <th>属性选择方式：</th>
        <td>
	  <input type='radio' name='attr_type' value='1' <?php if(isset($attrInfo['attr_type']) && $attrInfo['attr_type']==1)echo 'checked';?>> 单选属性  &nbsp;&nbsp;&nbsp;&nbsp;
	  <input type='radio' name='attr_type' value='2' <?php if (!isset($attrInfo['attr_type']) || (isset($attrInfo['attr_type']) && $attrInfo['attr_type']==2))echo 'checked';?>>  复选属性 <div class="infoShow">后台：单选只能选择一个，多选可选择多个, 前台:只能选择一个</div>
&nbsp;&nbsp;&nbsp;&nbsp;
	  <input type='radio' name='attr_type' value='3' <?php if (isset($attrInfo['attr_type']) && $attrInfo['attr_type']==3)echo 'checked';?>>复选属性 （前后台一样）<div class="infoShow">后台：多选可选择多个, 前台:也可以多选</div>
	  </td>
      </tr>
      <tr>
        <th>该属性值的录入方式：</th>
        <td>
          <input type="radio" value="0" name="attr_input_type" <?php if(isset($attrInfo['attr_input_type']) && $attrInfo['attr_input_type']==0)echo 'checked';?>>
          手工录入         
           <input type="radio" value="1" name="attr_input_type" <?php if(!isset($attrInfo['attr_input_type']) || (isset($attrInfo['attr_input_type']) && $attrInfo['attr_input_type']==1))echo 'checked';?>>
          从属性列表中设置
         </td>
      </tr>
      <tr>
        <th>该属性值所在类型：</th>
        <td>
          <?php foreach(C('size_type') as $val):?>
          <input type="radio" value="<?php echo $val['id'];?>" name="size_type" <?php if(isset($attrInfo['size_type']) && $attrInfo['size_type']==$val['id'])echo 'checked';?>>
          <?php echo $val['type_name'];?> 
          <?php endforeach;?>        
         </td>
      </tr>
      <tr>
        <th>归类：</th>
        <td>
            <select name="is_ll">
                <option value=0>普通</option>
                <option value=1 <?php if(isset($attrInfo['is_ll']) && $attrInfo['is_ll']==1)echo 'selected';?>>里料</option>
                <option value=2 <?php if(isset($attrInfo['is_ll']) && $attrInfo['is_ll']==2)echo 'selected';?>>隐藏</option>
            </select>
         </td>
		</tr>
		<tr>
			<th>3D文件夹名称：</th>
			<td>
				<input type="text" name="desc_name" id="desc_name" class="input-text" size="20" value="<?php echo isset($attrInfo['desc_name']) ? $attrInfo['desc_name'] : ''; ?>"/>
			</td>
		</tr>
      <tr>
        <th>排序：</th>
        <td><input type="text" name="sort_order" id="sort_order" class="input-text" size="5" value="<?php echo isset($attrInfo['sort_order']) ? $attrInfo['sort_order'] : 0;?>"/></td>
      </tr>
</table>
</div>
<?php 
$i = $base_tab+1;
	if(isset($languageList) && $languageList):
		foreach ($languageList as $language_id => $language_name):
?>
<div id="div_setting_<?php echo $i;?>" class="contentList pad-10 hidden">
	<table width="100%" id="properties-table" align="center">
  	<tr>
        <th width="150">属性名称：</th>
        <td>
			<input type="text" name="attribute[<?php echo $language_id;?>][name]" id="attr_name_<?php echo $language_id;?>" class="input-text" size='60' value="<?php echo isset($attrInfo['items'][$language_id]['name']) ? $attrInfo['items'][$language_id]['name'] : null;?>"/>
		</td>
      </tr>
	  
      <tr>
      	<th>属性描述:</th>
      	<td>
		  <textarea name="attribute[<?php echo $language_id;?>][attr_content]" class="editor" style="width: 629px; height: 125px;"><?php echo isset($attrInfo['items'][$language_id]['attr_content']) ? $attrInfo['items'][$language_id]['attr_content'] : null;?></textarea>
        </td>
      </tr>
  </table>
</div>
<?php 
		$i++;
		endforeach;
	endif;
?>
 <div class="bk15"></div>
 	<input type="hidden" name="model_id" value="<?php echo $modelid?>"/>
    <input name="dosubmit" type="submit" value="提交" class="button" id="dosubmit">
</div>
</div>
</form>

</body>
</html>
